﻿using LiteDB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace LiteDBEntity
{
    public interface ILiteDbRepository<T>
    {
        void Insert(T document);
        void Insert(IEnumerable<T> documents);
        bool Update(T document);
        bool Delete(BsonValue id);
        T FindOne(Expression<Func<T, bool>> predicate);
        IEnumerable<T> Find(Expression<Func<T, bool>> predicate);
        IEnumerable<T> FindAll();
        IEnumerable<T> FindAll(int index, int size, Expression<Func<T, bool>> predicate);
        T FirstOrDefault(Expression<Func<T, bool>> predicate);
        bool Exists(Expression<Func<T, bool>> predicate);
        void EnsureIndex<K>(Expression<Func<T, K>> property, bool unique = false);
        int Count();
        int Count(Expression<Func<T, bool>> predicate);
        void Dispose();

    }
}
